﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace gamexpert
{
    public partial class Default2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //((TopMenuBar)Session["TopMenuBar"]).MenuStatus = menuType.Home; 
            //string s2=AppDomainSetup.ApplicationBase;
            /*
            string s = Request.RawUrl;
            string s2 = Request.Path;
            string s3 = Request.PathInfo;
            string s4 = Request.UserHostAddress;
            string s5 = Request.AppRelativeCurrentExecutionFilePath;
            string s6 = Request.ApplicationPath;
             * */
            DataSet1 ds = new DataSet1();
            DataSet1TableAdapters.my_productTableAdapter da = new DataSet1TableAdapters.my_productTableAdapter();
            da.FillByDate(ds.my_product);
            
            
            Literal1.Text += "<ul>";
            for (int i = 0; i < 6; i++)
            {
                string s = ds.my_product.Rows[i]["title"].ToString();
                string s1=s;
                int l=26;
                if (s.Length > l )
                {
                    s = s.Substring(0, l) + "...";
                }
                Literal1.Text += "<li><a alt='" + s1 + "' title='" + s1 + "' href='Purchase.aspx?cat=" + ds.my_product.Rows[i]["category"] + "&id=" + ds.my_product.Rows[i]["id"] + "'>" + s + "</a></li>";
            }
            Literal1.Text += "</ul>";
            ds.my_product.Clear();
            da.FillByAssDate(ds.my_product);
            Literal2.Text += "<ul>";
            for (int i = 0; i < 6; i++)
            {
                string s = ds.my_product.Rows[i]["title"].ToString();
                string s1 = s;
                int l = 26;
                if (s.Length > l)
                {
                    s = s.Substring(0, l) + "...";
                }
                Literal2.Text += "<li><a alt='" + s1 + "' title='" + s1 + "' href='Purchase.aspx?cat=" + ds.my_product.Rows[i]["category"] + "&id=" + ds.my_product.Rows[i]["id"] + "'>" + s + "</a></li>";
            }
            Literal2.Text += "</ul>";
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet1 ds = new DataSet1();
                DataSet1TableAdapters.my_subscriberTableAdapter da = new DataSet1TableAdapters.my_subscriberTableAdapter();
                ds.my_subscriber.Addmy_subscriberRow(TextBox1.Text);
                da.Update(ds);
            }catch(Exception ex){

            }
            Response.Redirect("~/Subscribed.aspx");
        }
    }
}
